package com.guomao.controller;

import com.guomao.entity.Employee;
import com.guomao.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class EmployeeController {


    @Autowired
    private EmployeeService employeeService;

    //localhost:8080/ssm/queryEmps
    @RequestMapping("/queryEmps")
    public String queryEmployees(Model m) {
        System.out.println("EmployeeController.queryEmployees...");
        List<Employee> employees = employeeService.queryEmps();
        m.addAttribute("employees", employees);
        return "test";
    }
}